package cn.changsheng.csfenjie.task;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class OpStask implements Runnable {
	private final Player player;
	private final String cmd;

	public OpStask(Player player, String cmd) {
		this.player = player;
		this.cmd = cmd;
	}

	public void run() {
		if (this.player != null) {
			if (this.player.isOp()) {
				Bukkit.dispatchCommand(player, cmd);
			} else {
				player.setOp(true);
				Bukkit.dispatchCommand(player, cmd);
				player.setOp(false);
			}
		}
	}
}
